package com.project.workjob.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.project.workjob.entity.SkbDay;
import com.project.workjob.mapper.SkbDayMapper;
import com.project.workjob.service.SkbDayService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SkbDayServiceImpl implements SkbDayService {

    @Resource
    private SkbDayMapper skbDayMapper;

    @Override
    @DS("master")
    public List<SkbDay> getListForDay() {
        List<SkbDay> list = skbDayMapper.selectListByDay();
        return list;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    @DS("master")
    public void insert(List<SkbDay> list) {
        for (SkbDay skbDay : list) {
            skbDayMapper.insertSelective(skbDay);
        }
    }
}
